package thinkingInJava.io;

//: io/TestEOF.java
//Testing for end of file while reading a byte at a time.
import java.io.*;

public class TestEOF {
	public static void main(String[] args)
			throws IOException {
		DataInputStream in = new DataInputStream(
				new BufferedInputStream(
						new FileInputStream("TestEOF.java")));
		
		// available 工作方式会随着所读取的媒介类型的不同而有所不同
		// 字面意思是:在没有阻塞的情况下所能读取的字节数.对于文件就是整个文件.
		while(in.available() != 0) 
			System.out.print((char)in.readByte());
		in.close();
	}
} /* (Execute to see output) *///:~
